# include "scene.h"

# include <stdio.h>
# include <stdlib.h>

/* This function accepts the temperature in Kelvin and returns thermal conductivity of the water. */
extern double thm_cond(double T)
  {
   FILE *ptr;

#  ifdef RETURN_CONST_THMCOND
   T = T_INIT;
#  endif

   T -= ABS_ZERO;

   if(T < 0 || T > 100)
     {
#     ifdef _OPENMP_
      #pragma omp critical
#     endif
        {
         if((ptr = fopen("thm_cond_log.txt", "w")) == (FILE*)0) ptr = stderr;

         fprintf(ptr, "ERROR:: In function 'thm_cond()': \"T = %E Kelvin\"; However, it should be \"%E K <= T <= %E K\"\n",\
                      T+ABS_ZERO, 0+ABS_ZERO, 100+ABS_ZERO);

         if(ptr != stderr) fclose(ptr);

         exit(-1);
        }
     }

   return 5.6982E-1 + T*1.7959E-3 - T*T*6.9973E-6;
  }
